<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
  <script src="../lib/vue-2.4.0.js"></script>
</head>
<body>
<div id="app">
<!--
 需求：名字拼接   firstname + lastname = fullname
 -->

<!--  方案1： 通过按键事件监听方法 -->

  <input type="text" v-model="firstname" @keyup="getName"> +
  <input type="text" v-model="lastname" @keyup="getName"> =
  <input type="text" v-model="fullname" >

</div>

<script>
  var vm = new Vue({
    el:'#app',
    data:{
      firstname:'',
      lastname:'',
      fullname:'',
    },
    methods:{
      getName(){
        this.fullname = this.firstname + ' - ' + this.lastname
      }
    },
  })
</script>


</body>
</html>
